from django.db import models
from dvadmin.utils.models import CoreModel

# Create your models here.
class Profile(CoreModel):
    """想定模型"""
    name = models.CharField(max_length=255, unique=True, verbose_name='想定名称')
    md5 = models.CharField(max_length=255, verbose_name='md5')
    path = models.FileField(upload_to='./profile', verbose_name='想定文件')

    class Meta:
        db_table = 'profile'  # 指定数据库表名
        verbose_name = '想定'  # 在admin站点中显示的名称


class Scene(CoreModel):
    """仿真场景模型"""
    title = models.CharField(max_length=255, unique=True, verbose_name='标题')
    author = models.CharField(max_length=255, verbose_name='作者')
    detail = models.TextField(verbose_name='详情')
    image = models.ImageField(upload_to='./scene', verbose_name='缩略图')
    profile_id = models.CharField(max_length=255, verbose_name='想定id')
    cd_key = models.CharField(max_length=255, default='', verbose_name='cd-key')
    state_file = models.FileField(upload_to='./scene', default=None, verbose_name='状态空间描述文件')
    action_file = models.FileField(upload_to='./scene', default=None, verbose_name='动作空间描述文件')
    python_project_path = models.CharField(max_length=255, default='', verbose_name='上传的python工程')

    class Meta:
        db_table = 'scene'  # 指定数据库表名
        verbose_name = '场景'  # 在admin站点中显示的名称